#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int* twoSum(int* numbers, int numbersLen, int target, int* returnSize) 
{
    int* answer = (int*)malloc(sizeof(int) * 2);
    int i = 0;
    for (i = 0; i < numbersLen; i++)
    {
        if (numbers[i] > target + 10)
        {
            continue;
        }
        else
        {
            for (int j = i + 1; j < numbersLen; j++)
            {
                if (numbers[i] + numbers[j] == target)
                {
                    answer[0] = i + 1;
                    answer[1] = j + 1;
                }
            }
        }
    }
    *returnSize = 2;
    return answer;
}
int main()
{
    int len = 0;
    int retsize = 0;
    int i = 0;
    int target = 0;
    scanf("%d", &len);
    int* arr = (int*)malloc(sizeof(int) * len);
    for (i = 0; i < len; i++)
    {
        scanf("%d", &arr[i]);
    }
    scanf("%d", &target);
    int* ret = twoSum(arr, len, target, &retsize);
    for (i = 0; i < retsize; i++)
    {
        printf("%d ", *(ret + i));
    }
    return 0;
}